<?php
//
//	file: includes/ucp/ucp_aucp_rank.php
//	begin: 10/07/2006
//	$Author: christopher $
//	$Revision: 28 $
//	$Date: 2008-01-28 23:55:41 +0000 (Mon, 28 Jan 2008) $
//	license: http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
//
//	description: modifies the preferences section to include a custom rank

if ( !defined('IN_PHPBB') )
{
	die('Hack attempt');
}
// verify Custom Title Status
$membertime = time() - $user->data['user_regdate'];
$custom_rank_activated = false;

if (( $user->data['user_custom_rank_status'] == CUSTOM_RANK_ENABLED ) ||
	(( $user->data['user_custom_rank_status'] == CUSTOM_RANK_REGDATE ) &&
	( $membertime >= $config->data['aucp_rank_days'] * 86400) &&
	( $user->data['user_posts'] >= $config->data['aucp_rank_posts'])))
{
	$custom_rank_activated = true;
}

// verify the user is allowed to alter their custom rank
if ($custom_rank_activated == false)
{
	unset($fields['user_custom_rank']);
}

// verify custom rank mode
switch($config->data['aucp_rank_mode'])
{
	case CUSTOM_RANK_INDEPENDENT:
		$custom_rank_explain = $user->lang('aucp_rank_independent_explain');
		break;
	case CUSTOM_RANK_REPLACE_RANK:
		$custom_rank_explain = $user->lang('aucp_rank_replace_rank_explain');
		break;
	case CUSTOM_RANK_REPLACE_BOTH:
		$custom_rank_explain = $user->lang('aucp_rank_replace_both_explain');
		break;
	default:
		break;
}
$lang['aucp_rank_explain'] = sprintf($user->lang('aucp_rank_explain'), $custom_rank_explain, $fields['user_custom_rank']['length_maxi']);

// ok, all is ready, start with the form
include($config->url('includes/ucp/ucp_generic'));

?>
